package cn.edu.xmu.oomall.liquidation.microservice;

import cn.edu.xmu.oomall.liquidation.microservice.vo.PageVo;
import cn.edu.xmu.oomall.liquidation.microservice.vo.PaymentRetVo;
import cn.edu.xmu.oomall.liquidation.microservice.vo.RefundRetVo;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;

@FeignClient(name = "payment-service")
public interface PaymentService {
    /**
     * 这原来是个外部api，复制一个内部api的版本
     * @param shopId
     * @param state
     * @param beginTime
     * @param endTime
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping( "/internal/shops/{shopId}/payment")
    InternalReturnObject<PageInfo<PaymentRetVo>> getPaymentByStateAndTime(@PathVariable("shopId") Long shopId,
                                                                        @RequestParam Integer state,
                                                                        @RequestParam ZonedDateTime beginTime,
                                                                        @RequestParam ZonedDateTime endTime,
                                                                        @RequestParam Integer page,
                                                                        @RequestParam Integer pageSize);

    /**
     * 这原来是个外部api，复制一个内部api的版本
     * @param shopId
     * @param state
     * @param beginTime
     * @param endTime
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping( "/internal/shops/{shopId}/refund")
    InternalReturnObject<PageInfo<RefundRetVo>> getRefundByStateAndTime(@PathVariable("shopId") Long shopId,
                                                                        @RequestParam Integer state,
                                                                        @RequestParam ZonedDateTime beginTime,
                                                                        @RequestParam ZonedDateTime endTime,
                                                                        @RequestParam Integer page,
                                                                        @RequestParam Integer pageSize);

    /**
     * 修改支付单状态为已清算 路径你们
     * @param id
     * @return
     */
    @PutMapping("/internal/payment/{id}/liquidated")
    InternalReturnObject changePaymentLiquidated(@PathVariable("id") Long id);

    /**
     * 修改退款单状态为已清算
     * @param id
     * @return
     */
    @PutMapping("/internal/refund/{id}/liquidated")
    InternalReturnObject changeRefundLiquidated(@PathVariable("id") Long id);
}
